package com.net.oil.main.presenter;

import com.net.oil.base.BasePresenter;
import com.net.oil.main.bean.NewsTypeBean;
import com.net.oil.main.contract.NewsContract;
import com.net.oil.main.model.NewsModel;

import java.util.List;

/**
 * 作者：lch
 * 时间：2018/3/14:16:58
 * 邮箱：245850413@qq.com
 * 说明：
 */

public class NewsPresenter extends BasePresenter<NewsContract.View> implements NewsContract.Presenter {

    private NewsContract.View view;
    private NewsContract.Model model;

    public NewsPresenter(NewsContract.View view) {
        this.view = view;
        this.model = new NewsModel(this);
    }

    @Override
    protected void unSubscribe() {
        model.unSubscribe();
    }

    /**
     * 获取新闻类型
     */
    @Override
    public void getNewsType() {
        model.getNewsType();
    }

    /**
     * 获取新闻类型成功
     * @param newsTypeBeanList  返回的数据类型
     */
    @Override
    public void getNewsTypeSuccess(List<NewsTypeBean> newsTypeBeanList) {
        view.getNewsTypeSuccess(newsTypeBeanList);
    }

    /**
     * 获取新闻类型失败
     */
    @Override
    public void getNewsTypeFailed() {
        view.getNewsTypeFailed();
    }
}
